﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>添加品牌</title>
    <link rel="stylesheet" type="text/css" href="/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/Style/main.css">
    <script type="text/javascript" src="/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
</head>
<body style="height:100%;">
    <form id="form1" class="easyui-form" action="/api/Brand/Add" method="post" data-options="novalidate:true">
        <table class="tb60" border="0" cellpadding="0" cellspacing="0" style="min-height:300px">
            <tr class="tr60">
                <td class="td60">名称：</td>
                <td colspan="3">
                    <input id="Name" name="Name" type="text" class="easyui-textbox in180"
                           data-options="required:true,validType:'length[2,30]',missingMessage:'必须填写',invalidMessage:'限于3-30个字之间',
                           validateOnCreate:false,validateOnBlur:true">
                    <span class="ft99"> 限于2至30个字之间</span>
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">拼音：</td>
                <td colspan="3">
                    <input id="Pinyin" name="Pinyin" type="text" class="easyui-textbox in180">
                    <span class="ft99"> 拼音简码或助记码</span>
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">公司：</td>
                <td colspan="3">
                    <input id="Company" name="Company" type="text" class="easyui-textbox in280">
                </td>
            </tr>
            <tr class="tr120">
                <td class="td80">说明：</td>
                <td colspan="3"><input id="Desc" name="Desc" type="text" multiline="true" class="easyui-textbox" style="width:300px;height:80px"></td>
            </tr>
            <tr class="tr60">
                <td class="td80"></td>
                <td class="td20">
                    <a href="#" class="easyui-linkbutton btn" onclick="submitForm()" iconCls="icon-save" style="color: #009900;width:80px">保 存</a>
                </td>
                <td class="td80"></td>
                <td class="td20">
                    <a href="#" class="easyui-linkbutton btn" iconCls="icon-undo" style="color: #009900;width:80px">取 消</a>
                </td>
            </tr>
        </table>
    </form>
    <script type="text/javascript" src="/Scripts/pinyin_dict_firstletter.js"></script>
    <script type="text/javascript" src="/Scripts/pinyinUtil.js"></script>
    <script type="text/javascript">
        $(function () {

        });
        $('#Name').textbox({
            onChange: function (value) {
                var name = value;
                var pinyin = pinyinUtil.getFirstLetter(name);
                $("#Pinyin").textbox('setValue', pinyin);
            }
        });
        function savereg() {
            var sName = $("#Name").val();
            var sForm = $("#form1").serializeArray();
            console.debug(sName);
        }

        function submitForm() {
            $('#form1').form('submit', {
                onSubmit: function () {
                    return $(this).form('enableValidation').form('validate');
                },
                success: function (data) {
                    if (data == 1) {
                        alert("品牌信息添加成功。");
                        window.parent.closeThisTab();
                    }
                    else {
                        alert("很抱歉，遇到了一个技术问题，请稍后重试，或与技术人员联系。");
                    }
                }
            });
        }
    </script>
    <script type="text/javascript" src="/easyui/locale/easyui-lang-zh_CN.js"></script>

</body>
</html>
